package com.sskj.mine.bean;

import com.sskj.common.util.NumberUtil;

import java.util.HashMap;

public class AssetBean {


    static {
        typeMap = new HashMap<String, String>();
    }
    /**
     * id :
     * stockCode : USDT
     * stockName :
     * stockType :
     * usableFund : 3.4706
     * frostFund : 0
     * inAllFee : 0
     * outAllFee : 0
     */

    private String id;
    private String stockCode;
    private String stockName;
    private String stockType;
    private String usableFund;
    private String frostFund;
    private String inAllFee;
    private String outAllFee;
    public static HashMap<String, String> typeMap;

    public void setUsableFund(String usableFund) {
        this.usableFund = usableFund;
    }

    public String getFrostFund() {
        if (stockCode.endsWith("USDT")) {
            return NumberUtil.keepMax4(frostFund);
        } else {
            return NumberUtil.keepMax(frostFund, 8);
        }
    }

    public void setFrostFund(String frostFund) {
        this.frostFund = frostFund;
    }

    public String getUsableFund() {
        if (stockCode.endsWith("USDT")) {
            return NumberUtil.keepMax4(usableFund);
        } else {
            return NumberUtil.keepMax(usableFund, 8);
        }
    }


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getStockCode() {
        return stockCode;
    }

    public void setStockCode(String stockCode) {
        this.stockCode = stockCode;
    }

    public String getStockName() {
        return stockName;
    }

    public void setStockName(String stockName) {
        this.stockName = stockName;
    }

    public String getStockType() {
        if (typeMap.size() == 0) {
            typeMap.put("ETH", "1");
            typeMap.put("USDT", "2");
            typeMap.put("BTC", "2");
            typeMap.put("LTC", "2");
            typeMap.put("BCH", "3");
        }
        return typeMap.get(stockCode);
    }

    public void setStockType(String stockType) {
        this.stockType = stockType;
    }


    public String getInAllFee() {
        return inAllFee;
    }

    public void setInAllFee(String inAllFee) {
        this.inAllFee = inAllFee;
    }

    public String getOutAllFee() {
        return outAllFee;
    }

    public void setOutAllFee(String outAllFee) {
        this.outAllFee = outAllFee;
    }
}
